home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / What's New? / New System Software Extensions / QuickDraw 3D ß / Programming / Interfaces / QD3DStorage.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-04  |  5.6 KB  |  201 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DStorage.h                                             **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Abstraction to deal with various types of stream-based     **
  7.  **                    storage devices.                                         **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  *****************************************************************************/
  13. #ifndef QD3DStorage_h
  14. #define QD3DStorage_h
  15.  
  16. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  17. #include <Types.h>
  18. #include <Files.h>
  19. #endif  /*  OS_MACINTOSH  */
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif    /* __cplusplus */
  24.  
  25. /******************************************************************************
  26.  **                                                                             **
  27.  **                                Storage Routines                             **
  28.  **                                                                             **
  29.  *****************************************************************************/
  30.  
  31. TQ3ObjectType Q3Storage_GetType(
  32.     TQ3StorageObject    storage);
  33.  
  34. TQ3Status Q3Storage_GetSize(
  35.     TQ3StorageObject    storage,
  36.     unsigned long        *size);
  37.  
  38. /* 
  39.     Reads "dataSize" bytes starting at offset in storage, copying into data. 
  40.     sizeRead returns the number of bytes filled in. 
  41.     
  42.     You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  43. */
  44.  
  45. TQ3Status Q3Storage_GetData(
  46.     TQ3StorageObject    storage,
  47.     unsigned long        offset,
  48.     unsigned long        dataSize,
  49.     unsigned char        *data,
  50.     unsigned long        *sizeRead);
  51.  
  52. /******************************************************************************
  53.  **                                                                             **
  54.  **                             Memory Storage Prototypes                         **
  55.  **                                                                             **
  56.  *****************************************************************************/
  57.  
  58. EXPORT TQ3ObjectType Q3MemoryStorage_GetType(
  59.     TQ3StorageObject        storage);
  60.  
  61. /*
  62.  * These calls COPY the buffer into QD3D space
  63.  */
  64. EXPORT TQ3StorageObject Q3MemoryStorage_New(
  65.     const unsigned char        *buffer,
  66.     unsigned long            validSize);
  67.  
  68. EXPORT TQ3Status Q3MemoryStorage_Set(
  69.      TQ3StorageObject        storage,
  70.     const unsigned char        *buffer,
  71.     unsigned long            validSize);
  72.  
  73. /*
  74.  * These calls use the pointer given - you must dispose it when you're through
  75.  */
  76. EXPORT TQ3StorageObject Q3MemoryStorage_NewBuffer(
  77.     unsigned char            *buffer,
  78.     unsigned long            validSize,
  79.     unsigned long            bufferSize);
  80.  
  81. EXPORT TQ3Status Q3MemoryStorage_SetBuffer(
  82.      TQ3StorageObject        storage,
  83.     unsigned char            *buffer,
  84.     unsigned long            validSize,
  85.     unsigned long            bufferSize);
  86.  
  87. EXPORT TQ3Status Q3MemoryStorage_GetBuffer(
  88.      TQ3StorageObject        storage,
  89.     unsigned char            **buffer,
  90.     unsigned long            *validSize,
  91.     unsigned long            *bufferSize);
  92.  
  93. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  94.  
  95. /******************************************************************************
  96.  **                                                                             **
  97.  **                                Macintosh Handles Prototypes                 **
  98.  **                                                                             **
  99.  *****************************************************************************/
  100.  
  101. /* Handle Storage is a subclass of Memory Storage */
  102.  
  103. EXPORT TQ3StorageObject Q3HandleStorage_New(
  104.     Handle                    handle,
  105.     unsigned long            validSize);
  106.  
  107. EXPORT TQ3Status Q3HandleStorage_Set(
  108.      TQ3StorageObject        storage,
  109.     Handle                    handle,
  110.     unsigned long            validSize);
  111.  
  112. EXPORT TQ3Status Q3HandleStorage_Get(
  113.      TQ3StorageObject        storage,
  114.      Handle                    *handle,
  115.     unsigned long            *validSize);
  116.  
  117. /******************************************************************************
  118.  **                                                                             **
  119.  **                                Macintosh Storage Prototypes                 **
  120.  **                                                                             **
  121.  *****************************************************************************/
  122.  
  123. EXPORT TQ3StorageObject Q3MacintoshStorage_New(                    
  124.     short                    fsRefNum);    /* Note: This storage is assumed open */
  125.  
  126. EXPORT TQ3Status Q3MacintoshStorage_Set(
  127.      TQ3StorageObject        storage,
  128.     short                    fsRefNum);
  129.  
  130. EXPORT TQ3Status Q3MacintoshStorage_Get(
  131.      TQ3StorageObject        storage,
  132.     short                    *fsRefNum);
  133.     
  134. EXPORT TQ3ObjectType Q3MacintoshStorage_GetType(
  135.     TQ3StorageObject        storage);
  136.  
  137.  
  138. /******************************************************************************
  139.  **                                                                             **
  140.  **                            Macintosh FSSpec Storage Prototypes                 **
  141.  **                                                                             **
  142.  *****************************************************************************/
  143.  
  144. EXPORT TQ3StorageObject Q3FSSpecStorage_New(
  145.     const FSSpec            *fs);
  146.  
  147. EXPORT TQ3Status Q3FSSpecStorage_Set(
  148.      TQ3StorageObject        storage,
  149.     const FSSpec            *fs);
  150.  
  151. EXPORT TQ3Status Q3FSSpecStorage_Get(
  152.      TQ3StorageObject        storage,
  153.     FSSpec                    *fs);
  154.  
  155. #endif  /*  OS_MACINTOSH  */
  156.  
  157.  
  158. /******************************************************************************
  159.  **                                                                             **
  160.  **                                    Unix Prototypes                             **
  161.  **                                                                             **
  162.  *****************************************************************************/
  163.  
  164. TQ3StorageObject Q3UnixStorage_New(
  165.     FILE                    *storage);
  166.  
  167. TQ3Status Q3UnixStorage_Set(
  168.      TQ3StorageObject        storage,
  169.     FILE                    *stdFile);
  170.  
  171. TQ3Status Q3UnixStorage_Get(
  172.      TQ3StorageObject        storage,
  173.     FILE                    **stdFile);
  174.     
  175. TQ3ObjectType Q3UnixStorage_GetType(
  176.     TQ3StorageObject        storage);
  177.  
  178.  
  179. /******************************************************************************
  180.  **                                                                             **
  181.  **                                Unix Path Prototypes                         **
  182.  **                                                                             **
  183.  *****************************************************************************/
  184.  
  185. TQ3StorageObject Q3UnixPathStorage_New(                    
  186.     const char                *pathName);                /* C string */
  187.  
  188. TQ3Status Q3UnixPathStorage_Set(            
  189.      TQ3StorageObject        storage,
  190.     const char                *pathName);                /* C string */
  191.  
  192. TQ3Status Q3UnixPathStorage_Get(            
  193.      TQ3StorageObject        storage,
  194.     char                    *pathName);                /* pathName is a buffer */
  195.  
  196. #ifdef __cplusplus
  197. }
  198. #endif    /* __cplusplus */
  199.  
  200. #endif /* QD3DStorage_h */
  201.